package com.ruoyi.smartcity.huanjing.controller;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.smartcity.huanjing.domain.HuanjingJiancedian;
import com.ruoyi.smartcity.huanjing.service.IHuanjingJiancedianService;
import com.ruoyi.smartcity.huanjing.service.IHuanjingKongqizhiliangService;
import com.ruoyi.smartcity.huanjing.service.IHuanjingShuizhiService;
import com.ruoyi.smartcity.huanjing.service.IHuanjingZaoshengService;
import com.ruoyi.smartcity.traffic.vo.EchartsOptionVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author harry
 * @公众号 Harry技术
 */
@RestController
@RequestMapping("/smartcity/huanjing/index")
public class HuanjingIndexController {
    @Resource
    private IHuanjingJiancedianService huanjingJiancedianService;
    @Resource
    private IHuanjingKongqizhiliangService huanjingKongqizhiliangService;
    @Resource
    private IHuanjingShuizhiService huanjingShuizhiService;
    @Resource
    private IHuanjingZaoshengService huanjingZaoshengService;

    //    柱状图-空气质量
    @GetMapping("/kongqizhiliang")
    public AjaxResult kongqizhiliang() {
        EchartsOptionVO list = huanjingKongqizhiliangService.kongqizhiliang();
        return AjaxResult.success(list);
    }

    //    柱状图-噪音
    @GetMapping("/zaosheng")
    public AjaxResult zaosheng() {
        EchartsOptionVO list = huanjingZaoshengService.zaosheng();
        return AjaxResult.success(list);
    }

    //    柱状图-水质
    @GetMapping("/shuizhi")
    public AjaxResult shuizhi() {
        EchartsOptionVO list = huanjingShuizhiService.shuizhi();
        return AjaxResult.success(list);
    }

    //    监测点状态-柱状图
    @GetMapping("/jiancedianStatus")
    public AjaxResult jiancedianStatus() {
        HuanjingJiancedian huanjingJiancedian = new HuanjingJiancedian();
        huanjingJiancedian.setStatus("故障");
        List<HuanjingJiancedian> list = huanjingJiancedianService.selectHuanjingJiancedianList(huanjingJiancedian);
        return AjaxResult.success(list);
    }

    //    告警饼状图
    @GetMapping("/jiancedianAlarm")
    public AjaxResult jiancedianAlarm() {
        List<Map<String, Object>> list = huanjingJiancedianService.jiancedianAlarm();
        return AjaxResult.success(list);
    }

}
